001    /* EVolve - an Extensible Software Visualization Framework
002     * Copyright (C) 2001-2002 Qin Wang
003     *
004     * This library is free software; you can redistribute it and/or
005     * modify it under the terms of the GNU Library General Public
006     * License as published by the Free Software Foundation; either
007     * version 2 of the License, or (at your option) any later version.
008     *
009     * This library is distributed in the hope that it will be useful,
010     * but WITHOUT ANY WARRANTY; without even the implied warranty of
011     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012     * Library General Public License for more details.
013     *
014     * You should have received a copy of the GNU Library General Public
015     * License along with this library; if not, write to the
016     * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
017     * Boston, MA 02111-1307, USA.
018     */
019    
020    /*
021     * EVolve is distributed at http://www.sable.mcgill.ca/EVolve/
022     */
023    
024    package EVolve.visualization.VizFactory;
025    
026    import EVolve.visualization.VisualizationDefinition;
027    import EVolve.visualization.Visualization;
028    
029    /**
030     * Factory of visualizations.
031     */
032    public abstract class VisualizationFactory implements Cloneable {
033        private VisualizationDefinition definition; // definition of the visualizations
034    
035        /**
036         * Creates a visualization factory.
037         */
038        public VisualizationFactory() {
039            definition = createDefinition();
040        }
041    
042        /**
043         * Gets the definition of the visualizations.
044         *
045         * @return  definition of the visualizations
046         */
047        public VisualizationDefinition getDefinition() {
048            return definition;
049        }
050    
051        /**
052         * Gets the name of the visualizations.
053         *
054         * @return  name of the visualizations
055         */
056        public abstract String getName();
057    
058        /**
059         * Gets the name of the visualization factory.
060         *
061         * @return  name of the visualization factory
062         */
063        public abstract String getFactoryName();
064    
065        /**
066         * Creates the definition of the visualizations.
067         *
068         * @return  definition of the visualizations
069         */
070        public abstract VisualizationDefinition createDefinition();
071    
072        /**
073         * Creates a visualization.
074         *
075         * @return  the visualization
076         */
077        public abstract Visualization createVisualization();
078    
079        public Object clone() {
080            VisualizationFactory o = null;
081            try {
082                o = (VisualizationFactory)super.clone();
083            } catch (CloneNotSupportedException e) {
084                e.printStackTrace();
085                return null;
086            }
087    
088            o.definition = (VisualizationDefinition)definition.clone();
089            return o;
090        }
091    }